< previous page page_545 next page >

Page 545
EXERCISE
Create a New Stored Procedure
1. Click the Stored Procedures folder.
2. Right-click and select the New Stored Procedure menu item.
3. In the SQL Editor window, type in the following code:
Create Procedure procEmpSalary
As
SELECT szLast_nm, sFirst_nm,
szEmployee_type, cSalary_amt
FROM tblEmployees
INNER JOIN tblEmpTypes
ON tblEmployees.lEmpType_id =
tblEmpTypes.lEmpType_id
analysis.gifThis syntax is for a SQL Server stored procedure that performs a join on the tblEmployees and tblEmpTypes tables and returns a resultset.

As you can see in Figures 27.13 and 27.14, the SQL Editor window is essentially the same for both stored procedures and triggers. This makes sense because a trigger is really just a special kind of stored procedure.
8160-0545a.gif
Figure 27.13
The SQL Editor window with a stored procedure.

 
< previous page page_545 next page >

If you like this book, buy it!